<?php
namespace Home\Controller;
use Think\Controller;
class QuestionController extends Controller {
    public function index(){
        $question = D('question');
        $list = $question->select();
        $this->assign(array(
            'list'        => $list
        ));
        $this->display();
    }

  	function qu(){
	  $question = D('question');
	  $id = I('get.id');
	  $where['question.id'] = $id;
	  $data = $question  -> join('question_answer on question.id = question_answer.question_id','left')//问题
                         -> join('users on question.users_id = users.users_id','left')//用户
	                     -> join('answer on question_answer.answer_id = answer.answer_id','left')//dabiao
	                     -> join('master on answer.master_id = master.id','left')//大师
						 -> field('question_answer.id as id,question.question_ctt,question.question_time,answer.answer_ctt,answer.answer_time,users.name,users.pic,master.master_img,master.master_name')
						 -> where($where)
						 -> select();
    // dump($data);
    // die;
	  $this->assign(array(
            'list'        => $data
            ));
	  $this->display();
    }
}